package com.weai.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 前端路由转发控制器
 * 使用通配符捕获所有前端路由并转发到index.html
 */
@Controller
public class ForwardController {
    
    /**
     * 捕获所有顶级路径并转发到index.html
     */
    @GetMapping(value = "/{path:[^\\.]*}")
    public String forward(@PathVariable String path) {
        return "forward:/index.html";
    }
    
    /**
     * 捕获所有二级路径并转发到index.html
     */
    @GetMapping(value = "/{path:[^\\.]*}/{subPath:[^\\.]*}")
    public String forwardLevel2() {
        return "forward:/index.html";
    }
    
    /**
     * 捕获所有三级路径并转发到index.html
     */
    @GetMapping(value = "/{path:[^\\.]*}/{subPath:[^\\.]*}/{subPath2:[^\\.]*}")
    public String forwardLevel3() {
        return "forward:/index.html";
    }
    
    /**
     * 捕获所有四级路径并转发到index.html
     */
    @GetMapping(value = "/{path:[^\\.]*}/{subPath:[^\\.]*}/{subPath2:[^\\.]*}/{subPath3:[^\\.]*}")
    public String forwardLevel4() {
        return "forward:/index.html";
    }
    
    /**
     * 所有solution路径转发
     */
    @GetMapping(value = "/solutions/**")
    public String forwardSolutions() {
        return "forward:/index.html";
    }
    
    /**
     * 所有deposit_ai路径转发
     */
    @GetMapping(value = "/deposit_ai/**")
    public String forwardDepositAi() {
        return "forward:/index.html";
    }
    
    /**
     * 所有taskboard路径转发
     */
    @GetMapping(value = "/taskboard/**")
    public String forwardTaskboard() {
        return "forward:/index.html";
    }
    
    /**
     * 所有auth路径转发
     */
    @GetMapping(value = "/auth/**")
    public String forwardAuth() {
        return "forward:/index.html";
    }
    
    /**
     * 所有WeeklyMonthlyReport路径转发
     */
    @GetMapping(value = "/WeeklyMonthlyReport/**")
    public String forwardWeeklyMonthlyReport() {
        return "forward:/index.html";
    }
    
    /**
     * 所有ai_reports路径转发
     */
    @GetMapping(value = "/ai_reports/**")
    public String forwardAiReports() {
        return "forward:/index.html";
    }
    
    /**
     * 所有ai_papers路径转发
     */
    @GetMapping(value = "/ai_papers/**")
    public String forwardAiPapers() {
        return "forward:/index.html";
    }
    
    /**
     * 所有ai_list路径转发
     */
    @GetMapping(value = "/ai_list/**")
    public String forwardAiList() {
        return "forward:/index.html";
    }
    
    /**
     * 所有ai_books路径转发
     */
    @GetMapping(value = "/ai_books/**")
    public String forwardAiBooks() {
        return "forward:/index.html";
    }
} 